<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>正在审批</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$(".trace").click(function(){
			    var imageUrl = "${ctx}/sys/workflow/resource/process-instance?pid=" + $(this).data("pid") + "&type=image";
				var html="<img src='"+imageUrl+"'/>";
				 top.$.jBox(html,{title:"流程图",width:800});
			})
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<shiro:hasPermission name="oa:workflow:leave:edit"><li><a href="${ctx}/oa/workflow/leave/form">请假申请</a></li></shiro:hasPermission>
		<shiro:hasPermission name="oa:workflow:leave:audit"><li><a href="${ctx}/oa/workflow/leave/list/task">请假办理</a></li></shiro:hasPermission>
		<li class="active"><a href="${ctx}/oa/workflow/leave/list/running">正在审批</a></li>
		<li><a href="${ctx}/oa/workflow/leave/list/finished">历史申请</a></li>
	</ul>
	<tags:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered ">
		<thead>
			<tr>
				<th>假种</th>
				<th>申请人</th>
				<th>申请时间</th>
				<th>开始时间</th>
				<th>结束时间</th>
				<th>当前节点</th>
				<th>任务创建时间</th>
				<th>流程状态</th>
				<th>当前处理人</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${leaves }" var="leave">
				<c:set var="task" value="${leave.task }" />
				<c:set var="pi" value="${leave.processInstance }" />
				<tr id="${leave.id }" tid="${task.id }">
					<td>${leave.leaveType }</td>
					<td>${leave.user.loginName }</td>
					<td>${leave.applyTime }</td>
					<td>${leave.startTime }</td>
					<td>${leave.endTime }</td>
					<td>
						<a class="trace" href='#' data-pid="${pi.id }" title="点击查看流程图">${task.name }</a>
					</td>
					<td>${task.createTime }</td>
					<td>${pi.suspended ? "已挂起" : "正常" }；<b title='流程版本号'>V: ${leave.processDefinition.version }</b></td>
					<td>${task.assignee }</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>
